feat(sinker): Ship 8 — Yuv440p RGBA wiring (reuses Yuv444p kernels)#22
Merged
feat(sinker): Ship 8 — Yuv440p RGBA wiring (reuses Yuv444p kernels)#22
Conversation
There was a problem hiding this comment.
Pull request overview
This PR wires RGBA output support for the Yuv440p (4:4:0 planar 8-bit) path in MixedSinker, and expands the test suite to validate RGBA behavior and Strategy A invariants across formats.
Changes:
- Add
with_rgba/set_rgbaAPIs forMixedSinker<Yuv440p>and implement RGBA emission in thePixelSinkrow-processing logic. - Extend cross-format Strategy A tests to include
Yuv440p(now 9 wired families). - Add a dedicated
Yuv440pRGBA test group (gray correctness + opaque alpha, RGB/RGBA byte identity, buffer-too-short error, SIMD vs scalar parity).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/sinker/mixed/planar_8bit.rs |
Adds RGBA buffer attachment APIs for Yuv440p and updates the row dispatcher to output RGBA directly (RGBA-only) or via RGB expansion (RGB+RGBA Strategy A). |
src/sinker/mixed/tests.rs |
Updates Strategy A invariant text/count and adds Yuv440p RGBA coverage (correctness, error handling, SIMD/scalar equivalence). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
10 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tranche 4c of Ship 8 sink-side RGBA. Wiring-only PR — adds
Yuv440p(4:4:0 planar, 8-bit) RGBA output by reusing theyuv_444_to_rgba_rowdispatcher that shipped in PR #19. No new kernel code anywhere in the crate; per-row math is identical to 4:4:4 (full-width chroma) — only the walker reads chroma rowr / 2.Smallest tranche of Ship 8 so far: 2 files modified, +222 / -9 net.
Scope
Yuv420pNv12,Nv21Yuv422p,Nv16Yuv444pNv24,Nv42Yuv440pyuv_444_to_rgba_rowfrom PR #19)Yuv420p9/10/12/14/16,P010/P012/P016Yuv422p9/10/12/14/16,Yuv440p10/12,P210/P212/P216Yuv444p9/10/12/14/16,P410/P412/P416Usage:
```rust
use colconv::{
frame::Yuv440pFrame,
sinker::MixedSinker,
yuv::{Yuv440p, yuv440p_to},
ColorMatrix,
};
let frame = Yuv440pFrame::new(&y_plane, &u_plane, &v_plane, w, h, w, w, w);
let mut rgb = vec![0u8; (w * h * 3) as usize];
let mut rgba = vec![0u8; (w * h * 4) as usize];
let mut sinker = MixedSinker::::new(w as usize, h as usize)
.with_rgb(&mut rgb)?
.with_rgba(&mut rgba)?;
// Both buffers requested → YUV→RGB math runs once via yuv_444_to_rgb_row,
// RGBA derived via expand_rgb_to_rgba_row (Strategy A from PR #20).
yuv440p_to(&frame, /full_range=/ true, ColorMatrix::Bt709, &mut sinker)?;
```
What's in this PR
Public API
Kernel work
Zero. 4:4:0 reuses the existing 4:4:4 dispatchers because the per-row math is identical (full-width chroma; the half-height layout is a walker concern —
yuv440p_toreads chroma rowr / 2and feedsYuv440pRowtoprocess, which receives full-width U/V slices indistinguishable from 4:4:4 to the kernel).MixedSinker integration
`MixedSinker::process` rewritten for Strategy A output mode resolution (mirrors the pattern landed in PR #20 across all 8 prior wired families):
The `compile_fail` doctest negative example moved forward from `MixedSinker::::with_rgba` to `MixedSinker::::with_rgba` (next not-yet-wired format — Tranche 5 high-bit-depth 4:2:0).
Doc updates
`docs/color-conversion-functions.md` § Ship 8 tranche tracker — mark 4c as the active PR, 4b as ✅ shipped (PR #20), promote tranche 5 to "next".
Tests
+4 lib tests on aarch64 (479 vs. 475 in PR #21):
No per-backend equivalence tests added — the SIMD paths exercised here are the existing `yuv_444_to_rgba_row` family, already covered by PR #19's per-backend Yuv444p RGBA tests across all 5 SIMD backends.
Local results (aarch64 macOS): 479 lib tests + 1 doctest pass; wasm32 + x86_64 cross-targets compile clean; clippy reports zero warnings.
What's deferred
PixelSinkcontract #2 priority unlock (after tranche 6, the 10-bit 4:2:2 ProRes / DNxHR family).PixelSinkcontract #2 from PR feat(sinker): Ship 8 — Nv24/Nv42 RGBA + Strategy A RGB→RGBA fan-out #20 review) and RGBA-plane bounds-check helper extraction across all 9 `process` impls (Copilot feat(yuv420p10): 10-bit YUV 4:2:0 planar → u8 + native u16 RGB #4). Should land before tranches 5+ start adding more high-bit-depth families.Test plan
🤖 Generated with Claude Code